package com.neo.goods.mapper;

import java.util.List;

import com.neo.common.domain.Goods;
import org.apache.ibatis.annotations.*;

/**
 * @Author: chenb
 * @CreateTime: 2024/3/21 8:27
 * @Description:
 */
@Mapper
public interface GoodsMapper {

  @Insert("  insert into tb_goods(category_id,goods_name,manufacture_time,shelf_life_quantity,shelf_life_unit,ext1,ext2,ext3,create_time,is_del)"
      + " values(#{category_id},#{goods_name},#{manufacture_time},#{shelf_life_quantity},#{shelf_life_unit},#{ext1},#{ext2},#{ext3},#{create_time},#{is_del}) ")
  @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
  int insert(Goods goods);

  @Select(" select * from tb_goods where is_del = '0' ")
  List<Goods> findAll();

  @Update(" UPDATE tb_goods  SET IS_DEL = '1'  WHERE ID = #{id}  ")
  void update_del(Goods goods);

  @Update(" UPDATE tb_goods  SET goods_name = #{goods_name}  WHERE ID = #{id}  ")
  void update(Goods goods);

  @Select(" select * from tb_goods where id = #{id} ")
  Goods findById(int id);
}
